/******************************************************************************
* This file is part of is32p218 platform,
* Copyright (c) 2009 HangZhou InfoStrong CO.,LTD. All rights reserved.
* This software may only be used under the terms of a valid, current,
* end user license from InfoStrong.
* Nothing else gives you the right to use this software.   
*
* Name:   drv_iflash.h
* Desc:   Internal Flash Driver header file
* Author: Jerry
* Date:   2009-9-15
* Note:   
* History:
*
******************************************************************************/

#include "def.h"

#ifndef __DRV_IFLASH_H__
#define __DRV_IFLASH_H__

#ifdef __cplusplus
extern "C" {
#endif

#define iFLASH_SECTOR_SIZE		0x800

#define iFLASH_OP_NONE			0x00
#define iFLASH_OP_WORD_PROGRAM	0x01
#define iFLASH_OP_PAGE_ERASE	0x02
#define iFLASH_OP_MAIN_ERASE	0x07
#define iFLASH_OP_CHIP_ERASE	0x0E

BOOL drv_iflash_read_data( U32 addr, U8 *p_data, U32 data_len );
BOOL drv_iflash_write_data( U32 addr, const U8 *p_data, U32 data_len );
BOOL drv_iflash_erase_sector(U32 sectorAddr);
BOOL drv_iflash_erase_multi_sector(U32 start,U32 end);
BOOL drv_iflash_write_word(U32 addr,U32 data);
void drv_iflash_init( void );
BOOL drv_iflash_check( void );

#ifdef __cplusplus
}
#endif

#endif /*__DRV_IFLASH_H__*/

